package helpers {
	import flash.display.DisplayObject;
	import flash.external.ExternalInterface;
	
	public class Console {
		public function Console() {
		}
		
		private static var time:Number = new Date().time;
		
		public static function string(text:String):void {
			var dateString:String = debugTimeString || "";
			
			if(ExternalInterface.available) {
				try {
					ExternalInterface.call('function(args) { if(window && window.console && window.console.log) { window.console.log(args); }  }', dateString + " " + (text || ""));		
				} 
				catch(error:Error) {
					
				}
			}
		}
		
		public static function log(...args):void { 
			args.unshift(debugTimeString);
			
			if(ExternalInterface.available) {
				try {
					ExternalInterface.call('function(args) { if(window && window.console && window.console.log) { window.console.log(args); }  }', args);		
				} 
				catch(error:Error) {
					
				}
			}		
		} 
		
		// ---
		
		private static function get debugTimeString():String {
			var date:Date = new Date(new Date().time - time);
			
			return '[' + date.getUTCHours() + ':' + date.getUTCMinutes() + ':' + date.getUTCSeconds() + '.'+ date.getUTCMilliseconds() + '] > ';
		}
		
	}
	
}